refactor: rename async middleware with Async*/async_* prefix; drop attempt_timeout#30
Merged
Conversation
Two-PR plan: PR 1 renames the async middleware surface and drops attempt_timeout; PR 2 adds sync Client + sync middleware/Retry/Bulkhead and makes RetryBudget thread-safe. Both PRs merge to main, then one release tag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ync_ prefix Aligns with httpx2's naming convention (sync default, Async* prefix on the async sibling). Sync versions will land in PR 2. Part of feat/async-prefix-rename. Suite is intentionally red until the cascade completes; greens up in the same PR.
attempt_timeout used asyncio.timeout to bound the whole attempt. It has no clean sync equivalent and the I/O slice is already covered by httpx2's per-phase Timeout. Removed from both worlds; users who need whole-attempt structured cancellation can compose a custom timeout middleware. Also drops the now-dead except builtins.TimeoutError branch (the only source was asyncio.timeout) and the builtins import.
… + async_* decorators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Middleware → AsyncMiddleware,Next → AsyncNext,Retry → AsyncRetry,Bulkhead → AsyncBulkhead,before_request/after_response/on_error → async_before_request/...,compose → compose_asyncto align with httpx2's naming convention (sync default,Async*prefix on the async sibling).AsyncRetry(attempt_timeout=...). Whole-attempt wall-clock bounds were the only feature that depended onasyncio.timeoutand have no clean sync equivalent. Users wanting whole-attempt bounds can compose a custom timeout middleware; per-phase I/O bounds remain available viahttpx2.Timeout.Part 1 of 2. Part 2 (sync
Client+ sync middleware) lands separately and the combined work cuts one release.Source spec:
planning/specs/2026-06-07-sync-client-design.md.Plan:
planning/plans/2026-06-07-sync-client-plan.mdTasks A1–A10.Breaking changes
Async*/async_*prefix).AsyncRetry(attempt_timeout=...)removed.Test plan
just lintcleanjust testall green (249 tests; coverage maintained at 100%)mkdocs build --strictclean🤖 Generated with Claude Code